(function() {
  define(['underscore'], function(_) {
    return _.mixin({
      generateOptions: function(collection, propId, propName, sizeLimit) {
        var options, optionsCont;
        optionsCont = [];
        options = {};
        if (collection && collection.models && collection.models.length) {
          if (!propId) {
            propId = "id";
          }
          if (!propName) {
            propName = "nome";
          }
          if (!sizeLimit) {
            sizeLimit = 60;
          }
          $.each(collection.models, function(i, model) {
            if (model.get(propName)) {
              if (model.get(propName).length > sizeLimit) {
                model.set(propName, model.get(propName).substr(0, sizeLimit) + "...");
              }
              options = {};
              options[model.get(propId)] = model.get(propName);
              return optionsCont.push(options);
            }
          });
        }
        return optionsCont;
      },
      removeItem: function(list, item) {
        var newList;
        newList = [];
        _.each(list, function(el, i) {
          if (!_.isEqual(el, item)) {
            return newList.push(el);
          }
        });
        list = newList;
        return list;
      }
    });
  });

}).call(this);
